package com.neuedu.elmserver.controller;


import com.neuedu.elmserver.service.FoodService;
import com.neuedu.elmserver.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 食品表 前端控制器
 * </p>
 *
 * @author wyh
 * @since 2024-11-07
 */
@RestController
@RequestMapping("/food")
@CrossOrigin
public class FoodController {

    @Autowired
    private FoodService foodService;
    /**
     * 根据商家编号查询食品列表
     * @param businessId
     * @return
     */
    @GetMapping("/listFoodByBusinessId")
    public ResultVO listFoodByBusinessId(Integer businessId){
        return  foodService.queryFoodByBusiness(businessId);
    }


    //    根据食品名称查找出所有包含该食品的商家id
    @GetMapping("getBusinessIdByFoodName")
    public ResultVO getBusinessIdByFoodName(String foodName){return foodService.getBusinessIdByFoodName(foodName);}
    /**
     * 根据排行编号查询食品列表
     * @param
     * @return
     */
    @GetMapping("/listFoodByLevelId")
    public ResultVO listFoodByLevelId(){

        return  foodService.queryFoodByLevelId();
    }

}
